<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<title>代理商查询</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script type="text/javascript">
$(document).ready(function() {
	
	$("#confirmBtn").click(
		function(){
			var dd = $("input[name=multi_sel]:checked");
			if(dd.length != 1){
				alert("请选择一条记录");
				return false;
			}
			var idd = dd.val();							
			if(dd.length == 0){
				alert("请选择记录");
				return false;
			}else{
                 window.opener.document.getElementById("accountNo").value=idd;
				 window.close();
			}
		});
		
		$("#sub").click(function(){
			$("#importForm").attr("action","<%=basePath %>query/queryAgentList.ct");
			$("#importForm").submit();
		
		});
  });
  
</script>
</head>
<body>
	<div class="subpage">
		<s:form id="importForm" action="queryAgentList.ct" method="post"
			namespace="/query"  theme="simple">
			<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="query_table">
				<tr>
					<td colspan="8" align="center">
						<h2 class="headline-inquires">
							代理商查询<br /> <span class="sub-title"></span>
						</h2>
					</td>
				</tr>
				<tr>
					<td colspan="8">&nbsp;</td>
				</tr>
				
						<s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
			  <td align="right" width="15%"></td>
			  <td>
                  <s:hidden name="searchCondition.orgCode" value="%{#session.session_merchant.orgCode}" />
			  </td>
			</s:if><s:else>
                <tr>
                    <td align="right" width="15%">所属机构：</td>
			    	<td><s:select cssClass="queryWidth" name="searchCondition.orgCode"
				     id="orgCode" list="#request.orgList" listKey="org_code" listValue="org_name" /></td>	 
				    <td align="right"></td>
				     <td></td>
				</tr>
				</s:else>
				
				<tr>
					<td align="right">代理商账号：</td>
					<td align="left" colspan="1"><s:textfield id="accountNo"
							name="searchCondition.accountNo" cssClass="queryWidth" /></td>
					<td align="right">代理商姓名：</td>
					<td align="left" colspan="1"><s:textfield id="realName"
							name="searchCondition.realName" cssClass="queryWidth" /></td>
				</tr>
						

				<tr>
					<td colspan="8" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div></td>
				</tr>

				<tr>
					<td colspan="8" align="center">
			   		 <s:submit value="查询" id="sub" /> 
					&nbsp;&nbsp;&nbsp;&nbsp; 
					 <input type="button" id='confirmBtn' value='确定'/>
					</td>
				</tr>
				<tr>
					<td colspan="8">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="8">&nbsp;</td>
				</tr>
			</table>
            <table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td colspan="6" align="center">
						<h2 class="headline-inquires">代理商列表</h2>
					</td>
				</tr>
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
						<tr>
						<td align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/profitShareDetail/queryAgentList.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
		</s:form>
			<table id="tableList" width="100%" class="table">
				<thead>
					<tr>
					    <th>选择</th>
					    <th>代理商名称</th>
						<th>代理商账号</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="term">
							<tr class="<s:if test="#stat.index%2==0">tr_0</s:if>">
                            <td align="center">
                             <s:checkboxlist name="multi_sel" list="#{#term.accountNo:''}"  theme="simple"/>
                            </td>                            
							<td>
							 <s:property value="#term.realName"/>
							</td>
							<td>
							 <s:property value="#term.accountNo"/>
							</td>					
							</tr>
						</s:iterator>
				</tbody>
			</table>
	</div>
</body>
</html>